#!/bin/bash

## 检测是否有自定义的 PHP_FRAMEWORK 环境变量, 存在则替换
if [ -n "$PHP_FRAMEWORK" ]; then
	cp -f "/etc/nginx/conf.d/$PHP_FRAMEWORK.conf" /etc/nginx/conf.d/active.conf
fi

## 检测是否有自定义的 SERVER_NAME 环境变量, 存在则替换
if [ -n "$SERVER_NAME" ]; then
	sed -i "s/server_name .*/server_name $SERVER_NAME;/" /etc/nginx/conf.d/active.conf
fi

rm -f /run/monit.pid

/usr/bin/monit -I

